<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Banner图片切换</title>
    <link rel="stylesheet" href="./css/index.css">
</head>

<body>
    <div id="mask">
        <div class="center">
            <h2 class="title">图片轮播</h2>
            <img :src="images[currentIndex]" class="displayed-image" alt="轮播图片">
            <div class="left" @click="prevImage">❮</div>
            <div class="right" @click="nextImage">❯</div>
        </div>
    </div>

    <script src="../js/vue.js"></script>
    <script>
        let app = new Vue({
            el: "#mask",
            data: {
                images: [
                    "../4.Vue/image/1.jpg",
                    "../4.Vue/image/paris.jpg",
                    // Add more image paths as needed
                ],
                currentIndex: 0
            },
            methods: {
                prevImage() {
                    this.currentIndex = (this.currentIndex - 1 + this.images.length) % this.images.length;
                },
                nextImage() {
                    this.currentIndex = (this.currentIndex + 1) % this.images.length;
                }
            }
        });
    </script>
</body>

</html>